//
// Created by Semir on 2020/4/25.
//

#include <iostream>

using namespace std;

const int MAX_N = 100005;
int n, m;
int arr[MAX_N];

int main() {
    cin >> n >> m;
    int sum = 0;
    int count = 0;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        if (sum + arr[i] < m) {
            sum += arr[i];
        } else if(sum + arr[i] == m) {
            sum = 0;
            count++;
        } else {
            sum = arr[i];
            count++;
        }
    }
    if (sum != 0) {
        count++;
    }
    cout << count << endl;
    return 0;
}